<template>
  <div class="cu-common-layout">
    <div class="cu-common-layout-center">
      <el-row class="cu-common-search-box" :gutter="16">
        <el-form @submit.native.prevent>
          <el-col :span="6">
            <el-form-item label="招商经理">
              <el-select v-model="query.userId" placeholder="招商经理" clearable>
                <el-option v-for="(item, index) in userList" :key="index" :label="item.realName" :value="item.id" />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="负责省份">
              <el-select v-model="query.provinceIds" placeholder="负责省份" clearable>
                <el-option v-for="(item, index) in provinceOptions" :key="index" :label="item.fullName" :value="item.id" />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item>
              <el-button type="primary" icon="el-icon-search" @click="search()">查询</el-button>
              <el-button icon="el-icon-refresh-right" @click="reset()">重置</el-button>
            </el-form-item>
          </el-col>
        </el-form>
      </el-row>
      <div class="cu-common-layout-main cu-flex-main">
        <div class="cu-common-head">
          <div>
            <el-button type="primary" icon="el-icon-plus" @click="addOrUpdateHandle()">新增</el-button>
          </div>
          <div class="cu-common-head-right">
            <el-tooltip effect="dark" content="刷新" placement="top">
              <el-link icon="icon-ym icon-ym-Refresh cu-common-head-icon" :underline="false" @click="reset()" />
            </el-tooltip>
            <screenfull isContainer />
          </div>
        </div>
        <custom-table v-loading="listLoading" :data="list">
          <el-table-column label="招商经理" prop="userId" align="left">
            <template slot-scope="scope">
              {{ scope.row.userId | dynamicText(userIdOptions) }}
            </template>
          </el-table-column>
          <el-table-column label="负责省份" prop="provinceIds" align="left">
            <template slot-scope="scope">
              {{ scope.row.provinceIds | dynamicText(provinceOptions) }}
            </template>
          </el-table-column>
          <el-table-column prop="description" label="备注" align="left" />
          <el-table-column label="操作" fixed="right" width="100">
            <template slot-scope="scope">
              <el-button type="text" @click="addOrUpdateHandle(scope.row.id)">编辑</el-button>
              <el-button type="text" @click="handleDel(scope.row.id)" class="cu-table-delBtn">删除</el-button>
            </template>
          </el-table-column>
        </custom-table>
        <pagination :total="total" :page.sync="listQuery.currentPage" :limit.sync="listQuery.pageSize" @pagination="initData" />
      </div>
    </div>
    <custom-form v-if="formVisible" ref="CustomForm" @refresh="refresh" />
  </div>
</template>
<script>
export { default } from './index.js'
</script>
